package org.example.frame;
import javax.swing.*;
import java.awt.*;
import org.example.model.*;
import org.example.panel.*;
import org.example.panel.datapanel.*;

/**
 * @author lenovo
 */

public class DataFrame extends JFrame {
    public DataFrame(User user){
        //组件准备
        JTabbedPane tabbedPane = new JTabbedPane();
        InDataPanel inData = new InDataPanel();
        OutDataPanel outData = new OutDataPanel();
        TotalDataPanel totalData = new TotalDataPanel();
        GraphDataPanel graphData = new GraphDataPanel();
        ClearDataPanel clearData = new ClearDataPanel();
        ReturnFramePanel returnFrame = new ReturnFramePanel(user,this);
        //添加组件
        tabbedPane.add("导入数据",inData);
        tabbedPane.add("导出数据",outData);
        tabbedPane.add("导出报表",totalData);
        tabbedPane.add("导出柱形图",graphData);
        tabbedPane.add("清空数据",clearData);
        tabbedPane.add("返回界面",returnFrame);
        add(new JLabel("当前用户用户名："+user.getUsername()), BorderLayout.NORTH);
        add(tabbedPane,BorderLayout.CENTER);
        //窗口设置
        setTitle("学生成绩管理->数据管理");
        setSize(500,400);
        setLocationRelativeTo(null);
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        validate();
    }
}
